WPS Office.apk(点击下载) / TemplateCouponActivity.java


package cn.wps.moffice.common.infoflow.internal.cards.template.coupon;

import android.app.LoaderManager;
import android.content.Context;
import android.content.Intent;
import android.content.Loader;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.TextView;
import cn.wps.moffice.cntemplate.bean.TemplateBean;
import cn.wps.moffice.main.framework.BaseTitleActivity;
import cn.wps.moffice.main.local.filebrowser.search.show.FilterPopup;
import cn.wps.moffice.templatecommon.ext.widget.PageGridView;
import cn.wps.moffice_eng.R;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.reflect.TypeToken;
import com.mopub.mobileads.VastIconXmlManager;
import defpackage.cup;
import java.util.ArrayList;
import java.util.List;

public class TemplateCouponActivity extends BaseTitleActivity implements View.OnClickListener, AdapterView.OnItemClickListener, FilterPopup.b, PageGridView.c, cup.n, fys {
    private ViewGroup cAF;
    private cuc cAj;
    private csy cAt;
    private int cBX;
    private PageGridView cES;
    private FilterPopup edX;
    private List<FilterPopup.a> egI;
    private TextView ehk;
    private float ehz;
    private LoaderManager mLoaderManager;
    private View mMainView;

    public static void a(Context context, float f) {
        Intent intent = new Intent(context, TemplateCouponActivity.class);
        intent.putExtra(FirebaseAnalytics.Param.PRICE, f);
        context.startActivity(intent);
    }

    private void loadData() {
        int i = this.cBX;
        float f = this.ehz;
        this.mLoaderManager.restartLoader(8, null, new LoaderManager.LoaderCallbacks<ctq>(new log(getApplicationContext()).HX("https://docer.wps.cn/v3.php/api/android/mb/search/keyword").eT("X-Requested-With", "XMLHttpRequest").eU("mb_app", String.valueOf(i)).eU(VastIconXmlManager.OFFSET, new StringBuilder().append(this.cAt.getCount()).toString()).eU("limit", new StringBuilder().append(10).toString()).eU("file_type", "1").eU("price_min", String.valueOf(f)).eU("price_max", String.valueOf(f + 1000.0f)).eU("del_img_scale", "1").b(new TypeToken<ctq>() {
            /* class defpackage.cup.AnonymousClass40 */
        }.getType()), this) {
            /* class defpackage.cup.AnonymousClass51 */
            final /* synthetic */ n cCM;
            final /* synthetic */ log cCV;

            {
                this.cCV = r1;
                this.cCM = r2;
            }

            @Override // android.app.LoaderManager.LoaderCallbacks
            public final Loader<ctq> onCreateLoader(int i, Bundle bundle) {
                return this.cCV;
            }

            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [android.content.Loader, java.lang.Object] */
            @Override // android.app.LoaderManager.LoaderCallbacks
            public final /* synthetic */ void onLoadFinished(Loader<ctq> loader, ctq ctq) {
                ctq ctq2 = ctq;
                if (this.cCM != null) {
                    if (!(ctq2 == null || ctq2.czy == null)) {
                        gnb.bB(ctq2.czy.czA);
                    }
                    this.cCM.a(ctq2);
                }
            }

            @Override // android.app.LoaderManager.LoaderCallbacks
            public final void onLoaderReset(Loader<ctq> loader) {
            }
        });
    }

    @Override // defpackage.cup.n
    public final void a(ctq ctq) {
        boolean z = true;
        ArrayList<TemplateBean> a = cuh.a(ctq, true);
        if (a == null || a.size() < 10) {
            z = false;
        }
        this.cES.c(z, a);
        if (this.cAt.getCount() <= 0) {
            this.cAF.setVisibility(0);
        }
    }

    @Override // cn.wps.moffice.templatecommon.ext.widget.PageGridView.c
    public final void auX() {
        loadData();
    }

    /* access modifiers changed from: protected */
    @Override // cn.wps.moffice.main.framework.BaseActivity
    public fys createRootView() {
        return this;
    }

    /* access modifiers changed from: protected */
    @Override // cn.wps.moffice.main.framework.BaseTitleActivity, cn.wps.moffice.main.framework.BaseActivity
    public void createView() {
        super.createView();
        this.mTitleBar.setGrayStyle(getWindow());
        this.mTitleBar.setIsNeedMultiDoc(false);
        this.mTitleBar.setMultiDocumentLayoutVisibility(false);
        this.mTitleBar.setIsNeedSearchBtn(true);
        this.mTitleBar.setSearchBtnClickListener(new View.OnClickListener() {
            /* class cn.wps.moffice.common.infoflow.internal.cards.template.coupon.TemplateCouponActivity.AnonymousClass1 */

            public final void onClick(View view) {
                gec.dr(TemplateCouponActivity.this);
            }
        });
        this.mTitleBar.setCustomBackOpt(new Runnable() {
            /* class cn.wps.moffice.common.infoflow.internal.cards.template.coupon.TemplateCouponActivity.AnonymousClass2 */

            public final void run() {
                TemplateCouponActivity.this.onBackPressed();
            }
        });
    }

    @Override // defpackage.fys
    public View getMainView() {
        if (this.mMainView != null) {
            return this.mMainView;
        }
        this.mMainView = LayoutInflater.from(this).inflate(R.layout.public_template_coupon_page_layout, (ViewGroup) null);
        this.cES = (PageGridView) this.mMainView.findViewById(R.id.gridview);
        this.cAF = (ViewGroup) this.mMainView.findViewById(R.id.list_error_default);
        this.cES.setNumColumns(2);
        this.cES.setOnItemClickListener(this);
        this.cES.setPageLoadMoreListenerListener(this);
        this.cAj = new cuc(this.mMainView, "android_docervip_docermall_tip", cqy.ctA);
        this.cAt = new csy(this, 2);
        this.cES.setAdapter((ListAdapter) this.cAt);
        this.cAF.setVisibility(8);
        this.mMainView.findViewById(R.id.type_layout).setOnClickListener(this);
        this.ehk = (TextView) this.mMainView.findViewById(R.id.type_text);
        this.ehk.setText(R.string.phone_home_new_search_all);
        this.ehz = getIntent().getFloatExtra(FirebaseAnalytics.Param.PRICE, 0.0f);
        this.mLoaderManager = getLoaderManager();
        this.edX = new FilterPopup();
        if (this.egI == null) {
            this.egI = gnb.wz(this.ehk.getText().toString());
        }
        dwp.at("docer_templates_category_show", String.valueOf(this.ehz / 100.0f));
        loadData();
        return this.mMainView;
    }

    @Override // defpackage.fys
    public String getViewTitle() {
        return getResources().getString(R.string.template_coupon_page_title);
    }

    @Override // cn.wps.moffice.main.local.filebrowser.search.show.FilterPopup.b
    public final void h(View view, int i) {
        switch (view.getId()) {
            case R.id.type_layout /*{ENCODED_INT: 2131368843}*/:
                this.cBX = this.egI.get(i).mType;
                this.ehk.setText(this.egI.get(i).heC);
                this.cAt.clear();
                loadData();
                return;
            default:
                return;
        }
    }

    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.type_layout /*{ENCODED_INT: 2131368843}*/:
                this.edX.a(view, this.egI, this);
                return;
            default:
                return;
        }
    }

    /* access modifiers changed from: protected */
    @Override // cn.wps.moffice.common.beans.OnResultActivity, cn.wps.moffice.main.framework.BaseActivity
    public void onDestroy() {
        super.onDestroy();
        if (this.mLoaderManager != null) {
            this.mLoaderManager.destroyLoader(8);
        }
    }

    @Override // android.widget.AdapterView.OnItemClickListener
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        TemplateBean templateBean = (TemplateBean) this.cES.getItemAtPosition(i);
        if (templateBean != null && !cup.c(this, cuh.b(templateBean))) {
            cup.a(this, templateBean, "android_credits_template_coupon_show", "android_vip_template_coupon_show", getViewTitle() + "_" + (this.ehz / 100.0f), null, true, null, "android_docer", "docer_" + getViewTitle());
        }
    }

    /* access modifiers changed from: protected */
    @Override // cn.wps.moffice.common.beans.CountDisplayTimeActivity, cn.wps.moffice.main.framework.BaseTitleActivity, cn.wps.moffice.common.beans.OnResultActivity, cn.wps.moffice.main.framework.BaseActivity
    public void onResume() {
        super.onResume();
        this.cAj.refresh();
    }
}